<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <?php if($type == 1){ ?>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Password')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-password" class="form-control" name="row[password]" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('安全密码')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-security_password" class="form-control" name="row[security_password]" type="text" >
            </div>
        </div>
    <?php }else if($type == 2){ ?>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('请输入用户名')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input class="form-control" id="nickname" oninput="switch_level()">
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('上级')}:</label>
            <div class="col-xs-12 col-sm-8">
                <select class="form-control" name="row[share_id]" id="share_id">
                    <option value="0">无</option>
                    <?php foreach($list as $v){ ?>
                    <option <?php if($row['share_id'] == $v['id']){ echo "selected"; }?> value="<?php echo $v['id'];?>"><?php echo $v['user'].'['.$v['id'].']'?> </option>
                    <?php } ?>
                </select>
            </div>
        </div>
        <script>
            function switch_level(){
                var list = jQuery.parseJSON('<?php echo json_encode($list);?>');
                var Cts = $('#nickname').val();
                var html = '<option value="0">无</option>';
                for(var i=0;i<list.length;i++){
                    if(list[i].user.indexOf(Cts) >= 0 || list[i].id == Cts){
                        html  += '<option value="'+list[i].id+'">'+list[i].user+'['+list[i].id+']</option>';
                    }
                }
                $('#share_id').html(html);
            }
        </script>
    <?php }else if($type == 3){ ?>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('等级')}:</label>
            <div class="col-xs-12 col-sm-8">
                <select class="form-control" name="row[level]">
                    <option <?php if($row['level'] == 1){ echo "selected"; }?> value="1">L1</option>
                    <option <?php if($row['level'] == 2){ echo "selected"; }?> value="2">L2</option>
                    <option <?php if($row['level'] == 3){ echo "selected"; }?> value="3">L3</option>
                    <option <?php if($row['level'] == 4){ echo "selected"; }?> value="4">L4</option>
                    <option <?php if($row['level'] == 5){ echo "selected"; }?> value="5">L5</option>
                    <option <?php if($row['level'] == 6){ echo "selected"; }?> value="6">L6</option>
                    <option <?php if($row['level'] == 7){ echo "selected"; }?> value="7">L7</option>
                    <option <?php if($row['level'] == 8){ echo "selected"; }?> value="8">L8</option>
                    <option <?php if($row['level'] == 9){ echo "selected"; }?> value="9">L9</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('锁定等级')}:</label>
            <div class="col-xs-12 col-sm-8">
                <select class="form-control" name="row[locking_level]">
                    <option <?php if($row['locking_level'] == 0){ echo "selected"; }?> value="0">否</option>
                    <option <?php if($row['locking_level'] == 1){ echo "selected"; }?> value="1">是</option>
                </select>
            </div>
        </div>
    <?php } ?>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
